/**
 * 时间复杂度：O（n)
 * 空间：O（1）//
 */

class Solution {
    public int maxArea(int[] height) {
        int maxC = 0;
        int left = 0;
        int right = height.length-1;
        while (left != right) {
            int area = (right-left)*Math.min(height[left],height[right]);
            if (maxC < area) {
                maxC = area;
            }
            if (height[left] < height[right]) {
                left++;
            }else {
                right--;
            }
        }
        return maxC;
    }
}